package com.bian.amqp.service;

import com.bian.amqp.bean.Book;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

/**
 * @author bianpengfei
 * @create 2019-02-05 16:37
 **/
@Service
public class BookService {

    @RabbitListener(queues = "bian")
    public void receive(Book book) {
        System.out.println("收到消息："+book);
    }

    @RabbitListener(queues = "bian.news")
    public void reveive02(Message message) {
        System.out.println(message.getBody());
        System.out.println(message.getMessageProperties());
    }
}
